<%@include file="/WEB-INF/common/taglibs.jsp"%>
<script type="text/javascript" src="${ctx}/resources/js/datatable-query.js"></script>
<script type="text/javascript" src="${supr}/js/widgets.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/admin/shop.js"></script>
<script type="text/javascript" src="/ckfinder/ckfinder.js"></script>
<link href="${ctx}/resources/css/custom.css" type="text/css" rel="stylesheet" />

																		
<c:if test="${entity eq null }">		 
<div class="row-fluid">

	<div class="span12">

		<div class="page-header">
			<h4>Please select an option set for Associated Shop Product </h4>
		</div>

<form class="form-horizontal seperator" method="post">
<!--optionSet --><div class="form-row row-fluid"><div class="span12"><div class="row-fluid"><label class="form-label span3">Option Set :</label><div class="span4 controls"><select name="optionSetId"><c:if test="${not empty optionSets}"><c:forEach var="single" items="${optionSets}"><option value="${single.id}"${(single.id == entity.optionSet.id)?'selected':'' }>${single.name}</option></c:forEach></c:if></select></div></div></div></div>
 <div class="form-row row-fluid">
				<div class="span12">
					<div class="row-fluid">
						<div class="form-actions">
							<div class="span3"></div>
							<div class="span4 controls">
								<button type="submit" class="btn btn-info marginR10">Save
									changes</button>
								<button class="btn btn-danger">Cancel</button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</form>

	</div>
	<!-- End .span12 -->

</div>






</c:if>

<c:if test="${entity ne null }">		 



<div class="row-fluid">
	<form class="form-horizontal seperator" method="post">
		<div class="span12">
			<div class="box gradient">
				<div class="title">
					<h4>
						<span class="icon16 icomoon-icon-equalizer-2"></span> <span>Products</span>

					</h4>
					<a href="#" class="minimize">Minimize</a>
				</div>

				<div class="content">
					<ul id="myTab" class="nav nav-tabs pattern">
						<li class="active"><a href="#general" data-toggle="tab">General</a></li>
						<li><a href="#identity" data-toggle="tab">Identity</a></li>
						<li><a href="#data" data-toggle="tab">Data</a></li>
						<li><a href="#unit" data-toggle="tab">Unit</a></li>
						<li><a href="#links" data-toggle="tab">Links</a></li>
						<li><a href="#reward" data-toggle="tab">Reward Points</a></li>
						<li><a href="#stockTab" data-toggle="tab">Stock</a></li>
						
						<c:if test="${entity ne null }">
							<li><a href="#attribute" data-toggle="tab">Attribute</a></li>
							<li><a href="#option" data-toggle="tab">Option</a></li>
							<li><a href="#discount" data-toggle="tab">Discount</a></li>
							<li><a href="#imageTab" data-toggle="tab">Image</a></li>
							<li><a href="#downloadTab" data-toggle="tab">Download</a></li>
						</c:if>
					</ul>


					<div class="tab-content tab-content-no-border">
						<%@ include file="../product/sub/general.jsp"%>
						<%@ include file="../product/sub/identity.jsp"%>
						<%@ include file="../product/sub/unit.jsp"%>
						<div class="tab-pane fade" id="data">
							<!--price -->
							<div class="form-row row-fluid">
								<div class="span12">
									<div class="row-fluid">
										<label class="form-label span3" for="price">Price :</label><input
											class="span4" id="price" name="price" type="text"
											value="${entity.price}" />
									</div>
								</div>
							</div>
							<!--marketPrice -->
							<div class="form-row row-fluid">
								<div class="span12">
									<div class="row-fluid">
										<label class="form-label span3" for="marketPrice">MarketPrice
											:</label><input class="span4" id="marketPrice" name="marketPrice"
											type="text" value="${entity.marketPrice}" />
									</div>
								</div>
							</div>
							<!--taxClass -->
							<div class="form-row row-fluid">
								<div class="span12">
									<div class="row-fluid">
										<label class="form-label span3">Tax Class :</label>
										<div class="span4 controls">
											<select name="taxClassId"><c:if
													test="${not empty taxClasses}">
													<c:forEach var="single" items="${taxClasses}">
														<option value="${single.id}"
															${(single.id == entity.taxClass.id)?'selected':'' }>${single.name}</option>
													</c:forEach>
												</c:if></select>
										</div>
									</div>
								</div>
							</div>
							<!--minimumQuantity -->
							<div class="form-row row-fluid">
								<div class="span12">
									<div class="row-fluid">
										<label class="form-label span3" for="minimumQuantity">Minimum
											Quantity :</label><input class="span4" id="minimumQuantity"
											name="minimumQuantity" type="text"
											value="${entity.minimumQuantity}" />
									</div>
								</div>
							</div>
							<!--newArrive -->
							<div class="form-row row-fluid">
								<div class="span12">
									<div class="row-fluid">
										<label class="form-label span3" for="newArrive">New
											Arrive :</label>
										<div class="left marginT5 marginR10">
											<div class="normal-toggle-button">
												<input
													<c:if test= "${entity.newArrive}"> checked=checked</c:if>
													type="checkbox" class="nostyle" fname="newArrive">
												<input class="nostyle" type="radio" name="newArrive"
													id="newArrive1" value="true"
													<c:if test= "${entity.newArrive}"> checked=checked</c:if>
													style="opacity: 0;"> <input class="nostyle"
													type="radio" name="newArrive" id="newArrive2" value="false"
													<c:if test= "${!entity.newArrive}"> checked=checked</c:if>
													style="opacity: 0;">
											</div>
										</div>
									</div>
								</div>
							</div>

			 

							<!--quantityUnitGroup -->

 

							<!--requireShipping -->
							<div class="form-row row-fluid">
								<div class="span12">
									<div class="row-fluid">
										<label class="form-label span3" for="requireShipping">Require
											Shipping :</label>
										<div class="left marginT5 marginR10">
											<div class="normal-toggle-button">
												<input
													<c:if test= "${entity.requireShipping}"> checked=checked</c:if>
													type="checkbox" class="nostyle" fname="requireShipping">
												<input class="nostyle" type="radio" name="requireShipping"
													id="requireShipping1" value="true"
													<c:if test= "${entity.requireShipping}"> checked=checked</c:if>
													style="opacity: 0;"> <input class="nostyle"
													type="radio" name="requireShipping" id="requireShipping2"
													value="false"
													<c:if test= "${!entity.requireShipping}"> checked=checked</c:if>
													style="opacity: 0;">
											</div>
										</div>
									</div>
								</div>
							</div>

 							<div class="form-row row-fluid">
								<div class="span12">
									<div class="row-fluid">
										<label class="form-label span3" for="dateAvailable">Date
											Available:</label><input class="span4 datepicker" id="dateAvailable"
											name="dateAvailable" type="text"
											value="<fmt:formatDate pattern="yyyy-MM-dd" value="${entity.dateAvailable}" />" />
									</div>
								</div>
							</div>
	
							<!--status -->
							<div class="form-row row-fluid">
								<div class="span12">
									<div class="row-fluid">
										<label class="form-label span3" for="status">Status :</label>
										<div class="left marginT5 marginR10">
											<div class="normal-toggle-button">
												<input
													<c:if test= "${entity.status}"> checked=checked</c:if>
													type="checkbox" class="nostyle" fname="status"> <input
													class="nostyle" type="radio" name="status" id="status1"
													value="true"
													<c:if test= "${entity.status}"> checked=checked</c:if>
													style="opacity: 0;"> <input class="nostyle"
													type="radio" name="status" id="status2" value="false"
													<c:if test= "${!entity.status}"> checked=checked</c:if>
													style="opacity: 0;">
											</div>
										</div>
									</div>
								</div>
							</div>



						</div>
						<div class="tab-pane fade" id="links">
							<div class="span12">

								<!--manufacturer -->
								<div class="form-row row-fluid">
									<div class="span12">
										<div class="row-fluid">
											<label class="form-label span4">Manufacturer :</label>
											<div class="span6 controls">
												<select name="manufacturerId"><c:if
														test="${not empty manufacturers}">
														<c:forEach var="single" items="${manufacturers}">
															<option value="${single.id}"
																${(single.id == entity.manufacturer.id)?'selected':'' }>${single.name}</option>
														</c:forEach>
													</c:if></select>
											</div>
										</div>
									</div>
								</div>
								<div class="form-row row-fluid">
									<div class="span12">
										<div class="row-fluid">
											<label class="form-label span4">Categories:</label>
											<div class="span6">
												<div class="box plain box-with-clear-table">
													<div class="title"></div>
													<div class="content content-with-clear-table span12">
														<div>
															<table cellpadding="0" cellspacing="0" border="0"
																class="table  table-striped clear-table" id="checkAll">
																<tbody>
																	<c:forEach var="single" items="${categories}">
																		<tr>
																			<td class="chChildren"><input type="checkbox"
																				name="categoryIds" value="${single.id}"
																				class="styled" /> ${single.name}</td>
																		</tr>

																	</c:forEach>

																</tbody>
															</table>
														</div>
													</div>
												</div>
												<div id="masterCh" class="ch">
													<input type="checkbox" name="checkbox" value="all"
														class="styled">
													<button type="button" class="btn btn-link">Select/Unselect
														All</button>
													</input>
												</div>
											</div>

										</div>
									</div>
								</div>


								<div class="form-row row-fluid">
									<div class="span12">
										<div class="row-fluid">
											<label class="form-label span4" for="combobox">Related
												Products(Autocomplete):</label>
											<div class="span6 controls">
												<select class="nostyle autoselect tab-select"
													inputName="relatedProductIds">
													<option value="">Select one...</option>
													<c:forEach var="single" items="${products}">
														<option value="${single.id}" /> ${single.name}</option>
													</c:forEach>

												</select>
											</div>
										</div>
									</div>
								</div>
								<div class="form-row row-fluid">
									<div class="span12">
										<div class="row-fluid">
											<label class="form-label span4"></label>
											<div class="span6">
												<div class="box plain box-with-clear-table">
													<div class="title"></div>
													<div class="content content-with-clear-table">
														<div class="scroll"
															style="height: 200px; overflow: auto; margin-top: 0px;">
															<table
																class="table  table-striped clear-table autoselect-table"
																width="100%">
																<tbody>
																	<c:forEach var="single"
																		items="${entity.productRelated}">
																		<tr>
																			<td>${single.name}</td>
																			<td style="text-align: right;"><a class="deltr"><span
																					class="icomoon-icon-minus-circle-2"></span></a></td>
																			<input type="hidden" name="relatedProductIds"
																				value="${single.id}">
																		</tr>
																	</c:forEach>
																</tbody>
															</table>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>


							</div>
						</div>
						<%@ include file="../product/sub/reward.jsp"%>
						<%@ include file="../product/sub/stock.jsp"%>
						
						<c:if test="${entity ne null }">

							<%@ include file="../product/sub/attr.jsp"%>
							<%@ include file="../product/sub/discount.jsp"%>
							<%@ include file="../product/sub/image.jsp"%>
							<%@ include file="../product/sub/option.jsp"%>
							<%@ include file="../product/sub/download.jsp"%>






						</c:if>
					</div>

				</div>
				<div class="form-row row-fluid">
					<div class="span12">
						<div class="row-fluid">
							<div class="form-actions">
								<div class="span3"></div>
								<div class="span4 controls">
									<button type="submit" class="btn btn-info marginR10">Save
										changes</button>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

		</div>
		<!-- End .span6 -->
	</form>
</div>

<%@ include file="../product/model-div.jsp"%>

<c:if test="${entity ne null }">

	<script>
$(document).ready(function(){
$(".meta-div").appendTo($("#general"));
});

<c:forEach var="single" items="${entity.categories}">
$("input[name='categoryIds'][value='${single.id}']").attr("checked","checked");	
</c:forEach>
var meta_type="product";
</script>
	<c:set var="showName" value="true" />
	<%@include file="../../admin/meta/meta.jsp"%>
</c:if>

																			
 
           
</c:if>













<script>
$(document).ready(function(){
	 $( "body" ).undelegate( ".add-option-value", "click");
	 $( "body" ).undelegate( ".deltr", "click");
	 $( "body" ).undelegate(".delli", "click");
	 $(".add-option-value").attr("disabled","disabled");
	 $("button.deltr").attr("disabled","disabled");
	 $(".optionSelector").combobox().unbind("comboboxselect");
	 
	 $( "body" ).delegate( "a.deltr", "click", function() {
		 	$(this).parents("tr:first").remove();
	});
	 	 
 });


</script>